package com.xiaobai.exception;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xiaobai.Result.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

///**
// * @Author
// * @Description
// * @Date created in 11:48 2025/2/6
// */
//@RestControllerAdvice //全局异常处理器
//public class GlobalException {
//    private ObjectMapper objectMapper = new ObjectMapper();
//
//    @ExceptionHandler(Throwable.class)
//    public String error(Throwable e) throws JsonProcessingException {
//        R error = R.error(500, "操作失败,原因:" + e.getClass());
//        return objectMapper.writeValueAsString(error);
//    }
//}
